package com.elangzhi.ssm.model;

import com.elangzhi.ssm.model.base.BaseModel;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 商品评价表
 */
public class GoodsComment extends BaseModel {

    private Long id;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 商品ID
     */
    private Long goodsId;

    /**
     * 添加时间
     */
    private Date setTime;

    /**
     * 评价标签（暂时备用）
     */
    private String tags;

    /**
     * 评价类型（暂时备用）
     * 1，商品
     * 2，对人
     */
    private Integer type;

    /**
     * 评价得分
     */
    private Double score;

    /**
     * 评价内容
     */
    private String content;


    // 自定义列 实体映射用
    private String userName;  //用户姓名
    private String userHead;   //头像

    public GoodsComment(Long id, Long userId, Long goodsId, Date setTime, String tags, Integer type, String content) {
        this.id = id;
        this.userId = userId;
        this.goodsId = goodsId;
        this.setTime = setTime;
        this.tags = tags;
        this.type = type;
        this.content = content;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserHead() {
        return userHead;
    }

    public void setUserHead(String userHead) {
        this.userHead = userHead;
    }

    public GoodsComment() {
        super();
    }

    public Double getScore() {
        return score;
    }

    public void setScore(Double score) {
        this.score = score;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Long goodsId) {
        this.goodsId = goodsId;
    }

    public Date getSetTime() {
        return setTime;
    }

    public String getSetTime(String pattern) {
        if(setTime == null){ return ""; }
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
        return simpleDateFormat.format(setTime);
    }

    public void setSetTime(Date setTime) {
        this.setTime = setTime;
    }

    public String getTags() {
        return tags;
    }

    public void setTags(String tags) {
        this.tags = tags;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
}